package com.xc.quickstart.api.controller;

import com.alibaba.fastjson.JSON;
import com.xc.quickstart.api.query.SamplePersonQuery;
import com.xc.quickstart.common.annotation.GlobalApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "/api/inner/sample")
@Slf4j
@RestController
@Api(description = "api sample inner 接口", tags = "sample-inner")
@GlobalApiResponse
public class SampleInnerApiController {

    @ApiOperation(value = "说hello", notes = "说hello notes")
    @RequestMapping(value = "/hello1", method = {RequestMethod.POST, RequestMethod.GET})
    public String hello1(@ApiParam("name") @RequestParam String name) {
        return "hello1," + name;
    }

    @ApiOperation(value = "说hello", notes = "说hello notes")
    @RequestMapping(value = "/hello2", method = {RequestMethod.POST, RequestMethod.GET})
    public String hello2(@ApiParam("name") @RequestParam String name) {
        return "hello2," + name;
    }

    @RequestMapping(value = "/hello3", method = {RequestMethod.POST, RequestMethod.GET})
    @GlobalApiResponse(ignore = true)
    public String hello2(@RequestParam("samplePersonQuery") SamplePersonQuery samplePersonQuery) {
        return "hello:" + JSON.toJSONString(samplePersonQuery);
    }

}
